<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../reactBag/react.development.js"></script>
    <script src="../reactBag/react-dom.development.js"></script>
    <script src="../reactBag/babel.min.js"></script>
</head>

<body>

    <!-- 
        diffing算法的比较：
            - diffing算法比较 

     -->
    <button id="btn">点击修改</button>
    <div id="app"></div>


    <script type="text/babel">
        const arr = ['css','html','js','jq'];

        const vDom = (
            <ul>
                {
                    arr.map( item=>{
                        return <li key = {item} >{item}</li>
                    })
                }    
                
                
            </ul>
        )

        const root = ReactDOM.createRoot(document.getElementById('app'));
        root.render(vDom)
        //给按钮添加点击事件
        const oBtn = document.getElementById('btn');
        oBtn.onclick = function(){
            arr.unshift('react')
            const vDom=(
                <ul>
                    {
                    arr.map( item=>{
                        return <li key = {item} >{item}</li>
                    })
                }    
                    
                </ul>
            )
            root.render(vDom)
        }
    </script>
</body>

</html>